package com.ag.promanagement.dto;

import com.ag.presentation.backEndBeans.DocumentTypeView;

import com.ag.promanagement.DocumentType;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class DocumentTypeDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String type;
    private String id;
    private boolean rowSelected = false;
    private DocumentTypeView documentTypeView;
    private DocumentType documentType;

    public DocumentType getDocumentType() {
        return documentType;
    }

    public String listener_update(ActionEvent e) {
        try {
            documentTypeView.action_modifyWitDTO(((id == null) ||
                id.equals("")) ? null : new Long(id),
                ((type == null) || type.equals("")) ? null : new String(type));
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        id = documentType.getId().toString();
        type = (documentType.getType() != null)
            ? documentType.getType().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        id = documentType.getId().toString();
        type = (documentType.getType() != null)
            ? documentType.getType().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setDocumentType(DocumentType documentType) {
        this.documentType = documentType;
    }

    public DocumentTypeView getDocumentTypeView() {
        return documentTypeView;
    }

    public void setDocumentTypeView(DocumentTypeView documentTypeView) {
        this.documentTypeView = documentTypeView;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
